package org.fujay.langchain4jserver.infrastructure.persistence.mybatis.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.fujay.mybatis.core.base.BaseEntity;

import java.time.LocalDateTime;

/**
 * 知识库文件持久化实体 (对应 knowledge_files 表)
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "knowledge_files")
public class KnowledgeFilePo extends BaseEntity {

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    @TableField(value = "knowledge_base_id")
    private Long knowledgeBaseId; // 对应 KnowledgeBaseId.value

    @TableField(value = "file_name")
    private String fileName;

    @TableField(value = "file_path")
    private String filePath;

    @TableField(value = "file_size")
    private Long fileSize;

    @TableField(value = "file_type")
    private String fileType;

    /**
     * 对应 StorageStrategy 枚举的 code 1: LOCAL, 2: URL, 3: OSS
     */
    @TableField(value = "storage_strategy")
    private Integer storageStrategy;

    @TableField(value = "upload_time")
    private LocalDateTime uploadTime;

    /**
     * 对应 IndexStatus 枚举的 code 0: PENDING, 1: PARSING, 2: VECTORIZING, 3: STORING, 4: COMPLETED, 5:
     * FAILED
     */
    @TableField(value = "index_status")
    private Integer indexStatus;

    @TableField(value = "error_message")
    private String errorMessage;

    @TableField(value = "del_flag")
    @TableLogic
    private Integer delFlag;

}
